<template>
<div class="sort">
<div class="sorting">
     <div class="block">
    <span class="demonstration">分拣日期</span>
    <el-date-picker
      v-model="value3"
      type="date"
      placeholder="选择日期"
      format="yyyy 年 MM 月 dd 日"
      value-format="timestamp">
    </el-date-picker>
  </div>
  <div class="block">
  <span class="demonstration">分拣</span>
  <el-cascader
    v-model="values"
    :options="options"
    @change="handleChange"></el-cascader>
</div>
<div class="sortingLine">  <span>分拣状态</span>
<el-select v-model="value" placeholder="请选择">
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>
</div>
 <el-button type="primary" style="margin-left:100px;">主要按钮</el-button>
</div>
 <div></div>
<div class="table-light">
  <el-table
    :data="sortingList"
    border
    style="width: 100%">
    <el-table-column
      fixed
      prop="supervisorName"
      label="序号"
      type="index"
      width="200">
    </el-table-column>
    <el-table-column
      prop="sortSn"
      label="分拣单号"
      width="200">
    </el-table-column>
    <el-table-column
      prop="addTime"
      label="分拣日期"
      width="200">
    </el-table-column>
    <el-table-column
      prop="startAllocatingDate"
      label="开始时间"
      width="200">
    </el-table-column>
    <el-table-column
      prop="endAllocatingDate"
      label="结束时间"
      width="200">
    </el-table-column>
    <el-table-column
      prop="sortLineName"
      label="分拣线"
      width="200">
    </el-table-column>
      <el-table-column
      prop="shifts"
      label="班次"
      width="200">
      <template slot-scope="scope">
      <span v-if="scope.row.shifts == 1">早班</span>
      <span v-if="scope.row.shifts == 2">晚班</span>
</template>
    </el-table-column>
          <el-table-column
      prop="supervisorName"
      label="分拣主管"
      width="200">
    </el-table-column>
             <el-table-column
      prop="goodsCategory"
      label="品种数量"
      width="200">
    </el-table-column>
               <el-table-column
      prop="plannedProduction"
      label="计划数量"
      width="200">
    </el-table-column>
      <el-table-column
      prop="plannedProduction"
      label="计划数量"
      width="200">
    </el-table-column>
      <el-table-column
      prop="status"
      label="分拣状态"
      width="200">
      <template slot-scope="scope">
      <span v-if="scope.row.status == 0" >准备阶段</span>
      <span v-if="scope.row.status == 1" >排产</span>
      <span v-if="scope.row.status == 2" >生产完成</span>
</template>
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      width="200">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
        <el-button type="text" size="small">编辑</el-button>
      </template>
    </el-table-column>
  </el-table>
  </div>
  <!-- 分页器 -->
  <div class="current">
  <div class="block">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :page-size="1"
      :total="total">
    </el-pagination>
  </div>
</div>
</div>
</template>

<script>
import {fb,supervisor} from '../../api/user'
  export default {
    data() {
      return {
      sortingList:[],
      values:[],
      options:[],
      total: 0, // 用户总条数
      pagesize: 10, // 3.3 每页显示多少条，默认为10条
      pageNo: 1, // 当前页码，默认为第一页
        value1:'',
        value3: '',
        value: '',
      };
    },
  mounted(){
  this.getsortingList()
  this.supervisor()
  },
  methods: {
      handleClick(row) {
      console.log(row)
      },
       handleChange(value) {
        console.log(value);
      },
      getsortingList(){
       let data ={
         pageNo:this.pageNo,
         pageSize:this.pageSize
       }
       fb(data).then(res=>{
        console.log(res)
       this.sortingList = res.rows
       this.total=res.total
       })
      },
      handleSizeChange(val) {
        this.pagesize=val
        this.getsortingList()
      },
      handleCurrentChange(val) {
        this.pageNo=val
        this.getsortingList()
      },
      supervisor(){
        supervisor().then(res=>{
          console.log(res)
          this.options=res.rows
        })
      }
    },
  };
</script>

<style lang="scss">
.sorting{
    font-size: 12px;
    display: flex;
    align-items: center;
    padding:20px 40px;
    
.block{
    // padding:20px;
    margin-right: 20px;
    
}
.sortingLine{
    display: flex;
    align-items: center;
 >div{
     margin-right:20px;
 }
}
}
.table-light{
    padding:40px;
}
.current{
  .block{
  text-align: center;
  }
}
</style>